
	mui.init({});		
	var userinfo = app.getState() || {};
    var uid = userinfo.user_id;

	mui.plusReady(function() {
		document.getElementById('do_post').addEventListener('tap', function() {
			var btnArray = ['确定', '取消'];
			mui.confirm('确定要撤销此店铺吗，撤销店铺后将不能再申请店铺了！', '撤销店铺', btnArray, function(e) {
					if (e.index == 0) {
						var Info = {
							user_id: uid,
							content: document.getElementById('content').value.trim(),
							_token: userinfo.token
						};
						
						if(Info.content.length<5){
							plus.nativeUI.toast('撤销店铺的理由不能少于5个字');
							return false;
						}
						if(Info.content.length>250){
							plus.nativeUI.toast('撤销店铺的理由不能超过250个字');
							return false;
						}
						 mui.ajax({
							url: apiurl + "Store/cancel_shop/",
							data: Info,
							async: true,
							dataType: 'json',
							crossDomain: true, //强制使用5+跨域
							type: 'post',
							timeout: 10000,
							success: function(res) {
								console.log(JSON.stringify(res));
								if(res.status ==-3){
									mui.toast(res.msg);
									app.out();
									return false;
								}
								
								if(res.status==0){
									mui.toast(res.msg);
								}
								else{
									mui.toast(res.msg);
									userinfo.a1_money = res.data.a1_money;
									userinfo.a2_money = res.data.a2_money;
									app.setState(userinfo);
									mui.fire(plus.webview.getWebviewById('wallet.html'), 'refresh_data');	
									setTimeout(function(){
										location.href='../../../setting.html';
									},1000);
								}
								
							},
							error: function(xhr, type, errorThrown) {
								//console.log(JSON.stringify(xhr));
								//console.log(JSON.stringify(type));
								//console.log(JSON.stringify(errorThrown));
								mui.toast('操作失败！');
							}
						});
					} else {
						//
					}
				})
			
		}, false);
		
	});
	
	  